﻿@using GameSchool.Models.AccountModels
@model GameSchool.ViewModels.Exam.ResultsViewModel
@{
    ViewBag.Title = "Niðurstöðulisti fyrir " + Model.currentCourse.Code + Model.currentCourse.Name + Model.currentCourse.Semester.Year + "-" + Model.currentCourse.Semester.SemesterOfYear;
}
<h2>
    Niðurstöðulisti fyrir @Model.currentCourse.Code, @Model.currentCourse.Name, @Model.currentCourse.Semester.Year-@Model.currentCourse.Semester.SemesterOfYear</h2>
<table class="table table-striped">
    <tr>
        <th>
            Nafn
        </th>
        <th>
            Rétt svör
        </th>
        <th>
            Röng svör
        </th>
        <th>
            Einkunn
        </th>
        <th>
            Staða (rank)
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model.examsStudents.OrderBy(i => AccountProfile.GetProfileByUserId(i.StudentUserID).FullName))
    {
        <tr>
            <td>
                @if (item.ExamHistoryID.HasValue)
                {
                    @Html.ActionLink(AccountProfile.GetProfileByUserId(item.StudentUserID).FullName, "Details", new { id = item.ExamHistoryID })
                }
                else
                {
                    @Html.DisplayFor(modelItem => AccountProfile.GetProfileByUserId(item.StudentUserID).FullName);
                }
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CorrectAnswers)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.InCorrectAnswers)
            </td>
            <td>
                @string.Format("{0:0.0}", item.Grade)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Rank)
            </td>
            <td>
                @if (item.ExamHistoryID.HasValue)
                {
                    Html.ActionLink("Nánar", "Details", new { id = item.ExamHistoryID }, new { @class = "btn btn-mini" });
                }
            </td>
        </tr>
    }
</table>
<a href="@Url.Action("List", new { id = Model.currentCourse.CourseID })" class="btn">
    Til baka í prófalista</a> 